<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>TodoList</title>
    <%@ include file="/pages/common/header.jsp" %>
</head>
<body>
<div class="info">
    <span class="displayedUsername">${sessionScope.user.username}</span>
    <a href="UserServlet?action=logout" class="exit">退出登录</a>
</div>
<h1>编辑任务</h1>
<div class="greetings">Enjoy your coder life.</div>
<form action="TaskServlet" method="post">
    <input type="hidden" name="action" value="${requestScope.action}">
    <table id="content" style="width: 600px;">
        <tr>
            <th>编号</th>
            <th>任务名称</th>
            <th>任务状态</th>
            <th>操作</th>
        </tr>
        <tr>
            <td class="id"><input type="text" name="id" readonly="readonly" value="${empty task ? "NA": task.id}" style="width: 40px;text-align: center"></td>
            <td class="taskname"><input type="text" name="taskname" style="width: 300px" value="${empty task ? "" : task.taskname}"></td>
            <td class="status">
                <select name="status" id="status">
                    <c:choose>
                        <c:when test="${task.status == 1}">
                            <option value="未完成">未完成</option>
                            <option value="已完成" selected="selected">已完成</option>
                        </c:when>
                        <c:otherwise>
                            <option value="未完成" selected="selected">未完成</option>
                            <option value="已完成">已完成</option>
                        </c:otherwise>
                    </c:choose>
                </select>
            </td>
            <td class="action">
                <input type="submit" class="edit" value="提交">
            </td>
        </tr>
    </table>
</form>
</body>
</html>